#region File header

// Project: SharpWind, File: Button.cs
// Namespace: SharpWind.Gui.Controls, Class: Button
// Path: F:\Coder\Projekty\Windows\Dyplom\SharpWind\src\SharpWind\Gui\Controls, Author: Sebastian Haba (sho@gisz.net.pl)
// Code lines: 398, Size of file: 11,04 KB
// Creation date: 2007-03-29 12:38
// Last modified: 2007-04-01 11:51

#endregion

#region Using directives

using System;

using SharpWind.Resources;
using System.Drawing;

#endregion

namespace SharpWind.Gui.Controls
{
	/// <summary>
	/// Button
	/// </summary>
	public class Button : ButtonBase
	{
		public event EventHandler Click = null;

		protected Label label = null;

		public Button() : base( "button" )
		{
			label			= new Label();
			label.Text		= "button";
			label.TextAlign = TextAlign.MiddleCenter;
			label.Font		= Engine.Instance.Scene.Controls.Theme.Font;
			label.TextColor = Color.Black;
			Size			= new SizeF( 75, 25 );
		}

		protected override void OnMouseDown()
		{
			if( Click != null )
			{
				Click( this, EventArgs.Empty );
			}
		}

		internal override void Render()
		{
			if( Visible )
			{
				base.Render();
				this.label.Render();
			}
		}

		public override PointF Location
		{
			get
			{
				return base.Location;
			}
			set
			{
				base.Location = value;
				this.label.Location = value;

			}
		}

		public override SizeF Size
		{
			get
			{
				return base.Size;
			}
			set
			{
				base.Size = value;
				this.label.Size = value;
			}
		}
		
		public string Text
		{
			get
			{
				return this.label.Text;
			}
			set
			{
				if( this.label.Text != value )
				{
					this.label.Text = value;
				}
			}
		}
		
	} // class Button
} // namespace SharpWind.Gui.Controls